package pers.vinsonws.jianghu.clientwin.test;

/**
 * @auther vinsonws
 * @date 2018/11/13 0:29
 */
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.io.*;

class tab extends JFrame
{
    tab()
    {
        super("选项卡窗格");
        setVisible(true);
        setSize(500,310);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        JButton btn = new JButton("x");
        JLabel lab1 = new JLabel("选项卡");
        JTabbedPane pane = new JTabbedPane( );
        JPanel jp=new JPanel();
        GridLayout gl= new GridLayout(1,1,5,0);
        jp.setLayout(gl);
        JLabel lab = new JLabel("选项卡I");
        lab1.setHorizontalAlignment(JLabel.LEFT);//设置文字显示在最左边
//        Dimension preferredSize = new Dimension(30,30);
//        btn.setPreferredSize(preferredSize );
        //btn.setHorizontalAlignment(JLabel.RIGHT);// 设置文字显示在最右
        btn.setContentAreaFilled(false); //透明
        btn.setFont(new Font("宋体", Font.PLAIN, 12));
        btn.setMargin(new Insets(0, 0, 0, 0));
        //btn.setBorder(null);
        jp.add(lab1);
        jp.add(btn);
        pane.addTab("i",lab);
        pane.setTabComponentAt(pane.indexOfComponent(lab),jp);
        add(pane);
    }
    public static void main(String[] args)
    {
        new tab();
    }
}
